# SPDX-License-Identifier: Apache-2.0

zephyr_library()
zephyr_library_sources_ifdef(CONFIG_UART_ALTERA_JTAG uart_altera_jtag_hal.c)
zephyr_library_sources_if_kconfig(uart_imx.c)
zephyr_library_sources_if_kconfig(uart_cc13xx_cc26xx.c)
zephyr_library_sources_if_kconfig(uart_cc32xx.c)
zephyr_library_sources_if_kconfig(uart_cmsdk_apb.c)
zephyr_library_sources_if_kconfig(uart_esp32.c)
zephyr_library_sources_if_kconfig(uart_sifive.c)
zephyr_library_sources_if_kconfig(uart_gecko.c)
zephyr_library_sources_if_kconfig(leuart_gecko.c)
zephyr_library_sources_if_kconfig(uart_mcux.c)
zephyr_library_sources_if_kconfig(uart_mcux_flexcomm.c)
zephyr_library_sources_if_kconfig(uart_mcux_lpuart.c)
zephyr_library_sources_if_kconfig(uart_mcux_lpsci.c)
zephyr_library_sources_if_kconfig(uart_miv.c)
zephyr_library_sources_if_kconfig(uart_msp432p4xx.c)
zephyr_library_sources_ifdef(CONFIG_NRF_UART_PERIPHERAL uart_nrfx_uart.c)
zephyr_library_sources_ifdef(CONFIG_NRF_UARTE_PERIPHERAL uart_nrfx_uarte.c)
zephyr_library_sources_if_kconfig(uart_nsim.c)
zephyr_library_sources_if_kconfig(uart_sam.c)
zephyr_library_sources_if_kconfig(usart_sam.c)
zephyr_library_sources_if_kconfig(uart_stellaris.c)
zephyr_library_sources_if_kconfig(uart_stm32.c)
zephyr_library_sources_if_kconfig(uart_sam0.c)
zephyr_library_sources_if_kconfig(uart_psoc6.c)
zephyr_library_sources_if_kconfig(uart_pl011.c)
zephyr_library_sources_if_kconfig(uart_rv32m1_lpuart.c)
zephyr_library_sources_if_kconfig(uart_liteuart.c)
zephyr_library_sources_ifdef(CONFIG_UART_RTT_DRIVER uart_rtt.c)
zephyr_library_sources_if_kconfig(uart_xlnx_ps.c)

zephyr_library_sources_ifdef(CONFIG_USERSPACE   uart_handlers.c)

if(CONFIG_UART_NS16550)
  zephyr_library_sources(uart_ns16550.c)
  foreach(NUM RANGE 0 3)
    configure_file(
      uart_ns16550_port_x.h
      ${PROJECT_BINARY_DIR}/include/generated/uart_ns16550_port_${NUM}.h
      @ONLY
      )
  endforeach(NUM)
endif()

if(CONFIG_UART_NATIVE_POSIX)
  zephyr_library_compile_definitions(NO_POSIX_CHEATS)
  zephyr_library_sources(uart_native_posix.c)
endif()
